<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'新建邮件分类'))}
	<div class="frame">
		<form method='post' id="form_data" name="form_data" >
			<input type="hidden" name="opmode" id="opmode" value="add">
			
				<label class="input-label" for="is_del">状态：</label>
				<div class="input-block col-10 x-select">
					<select id="is_del" name="is_del"  class="input">
						<option value="0">启用</option>
						<option value="1">禁用</option>
					</select>
				</div>
			</div>
			
				<label class="input-label" for="sender_check">邮件到达时：</label>
				
					<input  type="checkbox" name="sender_check" id="sender_check" value="1" title="启用" />
					<label class="inline col-12">如果发件人</label>
					<div class="layui-inline  col-10 x-select">
						<select class="input col-10" type="select-one" id="sender_option" name="sender_option"  >
							<option selected="selected" value="1">包含</option>
							<option value="0">不包含</option>
						</select>
					</div>
					<div class="layui-inline">
						<input class="input col-20" type="text"  name="sender_key"  id="sender_key">
					</div>
					<span class="help-inline">例如：abc@abc.com</span>
				</div>
			</div>
			
				<label class="input-label" for="domain_check"></label>
				
					<input  type="checkbox" name="domain_check" id="domain_check" value="1" title="启用" />
					<label class="inline col-12">如果发件域</label>
					<div class="layui-inline col-10 x-select">
						<select class="input col-10" type="select-one" id="domain_option" name="domain_option"  >
							<option selected="selected" value="1">包含</option>
							<option value="0">不包含</option>
						</select>
					</div>
					<div class="layui-inline">
						<input class="input col-20" type="text"  name="domain_key"  id="domain_key">
					</div>
					<span class="help-inline">例如：@qq.com</span>
				</div>
			</div>

			
				<label class="input-label" for="recever_check"></label>
				
					<input  type="checkbox" name="recever_check" id="recever_check" value="1" title="启用" />
					<label class="inlinecol-12">如果收件人</label>
					<div class="layui-inline col-10 x-select">
						<select class="input" type="select-one" id="recever_option" name="recever_option"  >
							<option selected="selected" value="1">包含</option>
							<option value="0">不包含</option>
						</select>
					</div>
					<div class="layui-inline">
						<input class="input col-20" type="text"  name="recever_key"  id="recever_key">
					</div>
					<span class="help-inline">例如：abc@abc.com</span>
				</div>
			</div>

			
				<label class="input-label"></label>
				
					<input  type="checkbox" name="title_check" id="title_check" value="1" title="启用" />
					<label class="inline col-12">如果标题中</label>
					<div class="layui-inline col-10 x-select">
						<select class="input" type="select-one" id="title_option" name="title_option"  >
							<option selected="selected" value="1">包含</option>
							<option value="0">不包含</option>
						</select>
					</div>
					<div class="layui-inline">
						<input class="input col-20" type="text"  name="title_key"  id="title_key">
					</div>
					<span class="help-inline">例如：abc@abc.com</span>
				</div>
			</div>
			<hr>
			
				<label class="input-label" for="title_check">满足以上条件：</label>
				<div class="input-block x-select col-16">
					<select class="input"  id="to" name="to" >
						<option>请选择</option>
						{:fill_option($mail_folder)}
					</select>
				</div>
			</div>
			
				<div class="action input-block" >
					<a class="btn btn-normal" onclick="save()">保存</a>
					<a class="btn btn-return" onclick="go_return_url()">取消 </a>
				</div>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
		var $=layui.jquery;
		$("#btn_save").click(function() {
		if($(":checkbox:checked").length==0) {
		layer.msg("请至少选择一项");
		$("#sender_check").focus();
		return false;
		}
		if(($("#sender_check").attr("checked")=="checked")&&($("#sender_key").val()=="")) {
		layer.msg("内容不能为空");
		$("#sender_key").focus();
		return false;
		}
		if(($("#domain_check").attr("checked")=="checked")&&($("#domain_key").val()=="")) {
		layer.msg("内容不能为空");
		$("#domain_key").focus();
		return false;
		}
		if(($("#recever_check").attr("checked")=="checked")&&($("#recever_key").val()=="")) {
		layer.msg("内容不能为空");
		$("#recever_key").focus();
		return false;
		}
		if(($("#title_check").attr("checked")=="checked")&&($("#rtitle_key").val()=="")) {
		layer.msg("内容不能为空");
		$("#title_key").focus();
		return false;
		}
		if($("#to").val()=="") {
		layer.msg("请选择文件夹");
		$("#to").focus();
		return false;
		}
		send_form("form_data","{:url('save')}","{:url(index)}");
		});
		$("div.combo input").focus(function() {
		$(this).parent().find("label").hide();
		});
		$("div.combo input").blur(function() {
		if($(this).val().length==0) {
		$(this).parent().find("label").show();
		}
		});
		$("div.combo input").each(function() {
		if($(this).val().length>1) {
		$(this).parent().find("label").hide();
		}
		});
		});
	</script>

</block>